
<?php
 include("include/textcenter.php");
 include("include/db.php");
?>
<html>
<head>
<meta name="description" content="Admin<?php echo $tagdescription?>">
<meta name="keywords" content="<?php echo $tagkeywords?> Main">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo $tagtitle?></title>

<script type="text/javascript" src="simpletreemenu.js">
/***********************************************
* Simple Tree Menu- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" type="text/css" href="simpletree.css" />
<link rel="StyleSheet" href="include/css_classes.css" type="text/css">
<script src="jquery.min.js" type="text/javascript" charset="utf-8"></script>

</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" link="#0000FF" vlink="#800080" alink="#FF0000" bgcolor="#FFFFFF">
<!-- -------------------Header---------------------------- -->
<?php include("include/header.php"); ?>
<!-- -------------------End Header---------------------------- -->
<div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr>
		<td width="12%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="200" height="1"></td>
		<td width="1%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
		<td width="86%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
	</tr>	
	<tr>
		<!-- ///////////////////Begin Leftmenu/////////////////// -->
		<td width="12%" valign="top" bgcolor="#FFFFFF">
		<?php include("include/leftmenu.php"); ?>
		</td>
		<!-- ///////////////////End Leftmenu/////////////////// -->
		
		<td width="1%" valign="top" background="public/images/homepage/16.gif">&nbsp;</td>
		<td width="86%" valign="top">
	<br>
<!-- -------------------Begin Body---------------------------- -->
<p class="title16B">&nbsp;<a href="order_list.php">Order</a> 
 <?php
$list = $_POST['chk'];
for ($i=0; $i<count($list); $i++)
{
    //echo $list[$i];
?>
    <script language="javascript">
function Clickheretoprint()
{ 
        $.ajax({
        type: "POST",
        url: "order_update_printYN.php?id=" + $('#id').val(),
        success: function() {
        }
    });
		var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
		    disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
		var content_vlue = document.getElementById("<?php echo "print_content".$list[$i] ?>").innerHTML; 
		
		var docprint=window.open("","",disp_setting); 
			docprint.document.open(); 
			docprint.document.write('<html><head><title>Inel Power System</title>'); 
			docprint.document.write('</head><body onLoad="self.print()"><center>');          
			docprint.document.write(content_vlue);          
			docprint.document.write('</center></body></html>'); 
			docprint.document.close(); 
			docprint.focus(); 
}
</script>
<div class="style3" id="<?php echo "print_content".$list[$i]?>">
<?php
}
if(count($list)>0)
{
$listid = implode(",", $list);
    $sql = "SELECT o.*, c.* from vnf_shop_order o
            left JOIN vnf_customer c ON o.user_id = c.CustomerNo where order_id in (". $listid.")";
    $result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
    $odate_created = strtotime($row['date_created']);
    $sdate_created= date("Y-m-d",$odate_created);
    $id = $row['order_id'];
 ?>

 <p style="page-break-before:always">
<div style="text-align:center; width:100%; margin-bottom: 15px;"> <b style=" font-size:18px; color:gray ">skinspastore.com</b><br /></div>
<div style="width:100%; float:left;  margin-bottom: 10px;">
<div style="width:35%; float:left; text-align:right;"><b style=" font-size:18px; color:gray ">Invoice/Receipt</b></div>
<div style="width:65%; float:left; text-align:right;"><b style="color: #F9F; font-size: 16px; padding-left: 10px;">No.&nbsp;&nbsp;<?php echo $id?></b><br /></div>
</div>
<table  width="100%" width="70%" cellspacing="0" cellpadding="2" bordercolor="#FFECFF">
<tr style="border: 0 !important;">
		<td colspan="2">
            <div style="float: left;" align="left">
			BILL TO:<br />
			<?php echo $row['BillToFirstName'] ?>&nbsp;<?php echo $row['BillToLastName'] ?><br/>
			<?php echo $row['BillToAddress'] ?><br/>
			<?php echo $row['BillToCity'] ?> &nbsp;
			<?php echo $row['BillToState'] ?>&nbsp;
			<?php echo $row['BillToZipCode'] ?><br/>
			<?php echo $row['BillToCountry'] ?>
			</div>
            <div style="float: left; margin-left: 40%;">
                SHIP TO:<br />
    			<?php echo $row['ShipToFirstName']?>&nbsp; <?php echo $row['ShipToLastName'] ?><br/>
    			<?php echo $row['ShipToAddress'] ?><br/>
    			<?php echo $row['ShipToCity'] ?> &nbsp;
    			<?php echo $row['ShipToState'] ?>&nbsp;
    			<?php echo $row['ShipToZipCode'] ?><br/>
    			<?php echo $row['ShipToCountry'] ?>
            </div>
		</td>
		
	</tr>
    <tr>
		<td colspan ="2">
			<table border="1" style="width: 100%; margin-top:20px;">
				<tr>
					<td>
						Oder Date
					</td>
					<td>
						Status
					</td>
					<td>
						Ship Date
					</td>
					<td>
						Payment By
					</td>
					<td>
						Confirmation No
					</td>
					<td>
					Ship Ment
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $sdate_created;?> 
					</td>
					<td>
						<?php echo $row['order_status'];?> 
					</td>
					<td>
						<?php echo date("Y-m-d",strtotime($row['ShipDate']));?> 
					</td>
					<td>
						<?php echo $row['PaymentBy'];?> 
					</td>
					<td>
						<?php echo $row['ConfirmationNo'];?> 
					</td>
					<td>
						<?php echo $row['ShipMent'];?> 
					</td>
				</tr>
			</table><br />
            <table style="border-top: 1px solid #DBD2C8; width:100%;">
				<tr>
					<td style="background-color: #D5D5D5;">
						Quantity
					</td>
					<td style="background-color: #D5D5D5;">
						SKU
					</td>
					<td style="background-color: #D5D5D5;">
						Description
					</td>
					<td style="background-color: #D5D5D5; text-align: right;">
						Price
					</td>
					<td style="background-color: #D5D5D5; text-align: right;">
						Total
					</td>
				</tr>
                <?php
        $item = mysql_query("Select * from vnf_shop_order_item where OrderID='$id'");
    if(count($item)>0) 
    {
        $sum = 0;
        while($detail = mysql_fetch_array($item))
        {
    ?>
				<tr>
					<td>
						<?php echo $detail['Quantity'];?> 
					</td>
					<td>
						<?php echo $detail['SKU'];?> 
					</td>
					<td>
						<?php echo $detail['Product'];?> 
					</td>
					<td align="right">
						<?php echo "$".$detail['Price'];?> 
					</td>
					<td align="right">
						<?php echo "$".$detail['Quantity'] * $detail['Price'];?> 
					</td>
				</tr>
    <?php
        $sum += $detail['Quantity'] * $detail['Price'];
        }
        }
    ?>
					<tr>
				<td colspan="5" align="right">
                <div align="right" style="margin-top: 20px;">
                <?php
                    $subtotal = (int)$row['Subtotal'];
                    $shipping = (int)$row['ShippingCost'];
                    $tax = (int)$row['Tax'];
                    $total = $subtotal + $shipping + $tax;
                    $storecredit = -(int)$row['StoreCreditAmount'];
                    $totaldue = $total + $storecredit;
                ?>
                <table style="float: right; text-align: right;">
                    <tr>
                        <td colspan="2" style="text-align: right; color:red">
                        <?php
                            echo $row['CouponTitle'];
                        ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Subtotal
                        </td>
                        <td style="width: 80px;">
                        <?php echo "$".$sum;?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        <?php echo $row['ShipMethod'];?>  Shipping
                        </td>
                        <td>
                        <?php echo "$".$row['ShippingCost'];?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Sales Tax
                        </td>
                        <td>
                        <?php echo "$".$row['Tax'];?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Coupon
                        </td>
                        <td>
                        <?php echo "-$".$row['GiftCardAmount'];?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Store Credit
                        </td>
                        <td>
                        <?php echo "-$".$row['StoreCreditAmount'];?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        GiftCard
                        </td>
                        <td>
                        <?php echo "$".$row['GiftCardAmount'];?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        TOTAL DUE
                        </td>
                        <td>
                        <?php echo "$".$sum;?>
                        </td>
                    </tr>
                     <tr>
                        <td>
                        GiftWrapYN
                        </td>
                        <td>
                        <?php
                        if($row['GiftWrapYN:'] == 0)
                        {
                            echo "Yes";
                        }
                         else
                         {
                            echo "No";
                         }
                         ?>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        Staff Message
                        </td>
                        <td>
                        <input style="width: 120px; text-align: right;" type="text" id="StaffMessage" name="StaffMessage" value="<?php echo $row['StaffMessage'];?>" />
                        </td>
                    </tr>
                   
                </table>
                </div>
				</td>
				</tr>
                 <!--<tr>
                        <td colspan="2" align="left">
                        <?php
                        if($row['coupon_code'] != "" || $row['coupon_code']!= NULL)
                        {
                       
                        ?>
                            <p>You have received <?php echo $row['coupon_value'];?>% of ???? product!</p>
                         <?php
                          }
                        ?>
                        </td>
                    </tr>-->
			</table>
              </td>
       	</tr> 
            
</table>
</p>
  <br />
<?php
    }
?>
<input type="hidden" name="id" id="id" value="<?php echo $listid ?>" />
<?
    }
    else
    {
        echo "You do not choose order to print.";
    }
?>
    </div>
    
    <!-- <span style="padding: 0px 20px;"><a  href="javascript:printIt();" name="Print" id="Print">Print
     </a></span> -->
     <a href="javascript:Clickheretoprint()" style="font-size: 15px;" >Print</a>
<?php
    mysql_close($con);
?>
<!-- -------------------End Body---------------------------- -->

&nbsp;</td>
	</tr>

</table>
</div>
<!-- ----------------------------------------------- -->
<!-- \\\\\\\\\\\\\\\\\\\\\Begin Footer\\\\\\\\\\\\\\\\\\\\\ -->
<?php include("include/footer.php"); ?>
<!-- \\\\\\\\\\\\\\\\\\\\\End Footer\\\\\\\\\\\\\\\\\\\\\ -->
</body>

</html>